import React, { Component } from 'react'
import { AtTabBar } from 'taro-ui'

export default class BottomNavBar extends Component {

  state = {
    tabList: [
      { title: '商城', iconType: 'shopping-bag' },
      { title: '购物车', iconType: 'shopping-cart', text: '100', max: 99 },
      { title: '我的', iconType: 'user' }
    ],
    current: 0,
  }

  handleClick (current) {
    this.setState({ current });
    this.props.setCurrent(current);
  }


  render () {
    return <AtTabBar
      fixed
      tabList={this.state.tabList}
      onClick={(current) => this.handleClick(current)}
      current={this.state.current}
    />;
  }
}
